define(["jquery","template",
	"scprit/nutrition/app/nutritionApplication/nutritionApplicationDetails.servers.js",
	"scprit/nutrition/template/nutritionApplication/nutritionApplicationDetails.tpl.js"], 
    function($,template,$servers,tpl){
    var ui = {};

    var drawBasicInfo = function(data){
        return template("nutrition_basicInfo",data);
    }
    var drawSchemeName = function(data){
    	return template("nutrition_applicationSchemeName",data);
    }
    var drawStageNavbar = function(data){
        return template("nutrition_stageNavbar",data);
    }
    var drawCourseTableThead = function(data){
        return template("nutrition_applicationCourseTableThead",data);
    }
    var drawCourseTableTbody = function(data){
        return template("nutrition_applicationCourseTableTbody",data);
    }
    var drawEditAmount = function(data){
        return template("nutrition_applicationEditAmount",data);
    }
    var drawModifylist = function(data){
        return template("nutrition_applicationModifylist",data);
    }
    var drawSchemeList = function(data){
        return template("nutrition_applicationSchemeList",data);
    }
    var drawStartCourseStartTime = function(data){
        return template("nutrition_applicationStartCourseStartTime",data);
    }
    var drawContextMenu = function(data){
        return template("nutrition_applicationContextMenu",data);
    }

    ui.basicInfoInit = function(options){
        $("#" + options.id).html(tpl.basicInfo());
        var html = drawBasicInfo(options.data);
        $("#" + options.id).html(html);
    };
    ui.schemeNameInit = function(options){
        $("#" + options.id).html(tpl.schemeName());
        var html = drawSchemeName(options);
        $("#" + options.id).html(html);
    };
    ui.stageNavbarInit = function(options){
        $("#" + options.id).html(tpl.stageNavbar());
        var html = drawStageNavbar(options);
        $("#" + options.id).html(html);
    }
    ui.courseTableTheadInit = function(options){
        $("#" + options.id).html(tpl.courseTableThead());
        var html = drawCourseTableThead($servers.handleCourseTableThead(options.data));
        $("#" + options.id).html(html);
    }
    ui.courseTableTbodyInit = function(options){
        $("#" + options.id).html(tpl.courseTableTbody());
        var html = drawCourseTableTbody($servers.handleCourseTableTbody(options.data));
        $("#" + options.id).html(html);
    }
    ui.editAmountInit = function(options){
        options.dom.html(tpl.editAmount());
        var html = drawEditAmount(options);
        options.dom.html(html);
    }
    ui.modifylistInit = function(options){
        options.dom.html(tpl.modifylist());
        var html = drawModifylist($servers.handleModifylist(options.list));
        options.dom.html(html);
    }
    ui.schemeList = function(options){
        options.dom.html(tpl.schemeList());
        var html = drawSchemeList(options);
        options.dom.html(html);
    }
    ui.startCourseStartTime = function(options){
        options.dom.html(tpl.startCourseStartTime());
        var html = drawStartCourseStartTime(options);
        options.dom.html(html);
    }
    ui.contextMenu = function(options){
        $("#" + options.id).html( tpl.contextMenu() );
        var html = drawContextMenu(options);
        $("#" + options.id).html(html);
    }

    return ui;
});